<?php 
/**
* @orm tableName articles
*/
class Article extends DomArObject {
	/**
	* @orm text
	*/
	public $title;	
	/**
	* @orm plugin DomArDateTime(now)
	*/
	public $time;
	/**
	* @orm longtext
	*/
	public $introduction;	
	/**
	* @orm longtext
	*/
	public $contents;
	/**
	* @orm plugin DomArImage({relative=Articles/})
	* @orm listener afterAdd afterAddImage
	*/
	public $image;
	/**
	* @orm plugin DomArImage({relative=Articles/})
	*/
	protected $icon;
	/**
	* @orm has parent Category inverse articles
	*/
	public $category;
	
	/**
	* Makes icon for image.
	*/
	public function afterAddImage() {
		if( $this->image->exists() ) {
			$this->icon = $this->image->copy();
			$this->image->resize(800,600);
			$this->icon->resize(100,100, false);
			$this->icon->cut(100,100);
		}
	}
}
?>